<script setup lang="ts">
import { onMounted } from 'vue'
import * as echarts from 'echarts';

onMounted(() => {
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('reacharts'));

    // 指定图表的配置项和数据
    var option = {
        title: {
            text: '近一年的DAU/DNU'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['DAU', 'DNU']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
            }
        ],
        yAxis: [
            {
                type: 'value',
                max: '600',
            }
        ],
        series: [
            {
                name: 'DAU',
                type: 'line',
                stack: '总量',
                areaStyle: { normal: {} },
                data: [120, 132, 101, 134, 90, 230, 210, 134, 90, 230, 210, 230]
            },
            {
                name: 'DNU',
                type: 'line',
                stack: '总量',
                areaStyle: { normal: {} },
                data: [120, 132, 101, 134, 90, 230, 210, 134, 90, 230, 210, 290]
            }
        ]
    };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
})
</script>

<template>
    <div id="reacharts" style="width: 100%;height:100%;"></div>
</template>
